package com.nf.xiaomi.service;

import com.nf.xiaomi.entity.CartItemEntity;
import com.nf.xiaomi.entity.OrderEntity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;
import java.util.List;

public interface OrderService {
    List<OrderEntity> getAll();

    List<OrderEntity> getAll(Integer orderState);

    List<OrderEntity> getAll(Long account);

    Integer insert(OrderEntity order);

    Integer update(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException;

    Integer deleteByID(Long account, Integer orderID);

    List<OrderEntity> total();

    List<OrderEntity> confirmOrder(Long account, Integer orderID);

    Long paymentCount(Long account);

    Long goodsCount(Long account);

    Long recycleCount(Long account);

    default Integer[] getDetailIds(List<OrderEntity> orderEntityList){
        Integer[] ids=new Integer[orderEntityList.size()];
        for (int i = 0; i < orderEntityList.size(); i++) {
            ids[i]=orderEntityList.get(i).getProductDetailID();
        }
        return ids;
    }
}
